package com.kai.steering.data.service.entity.domainObject;

import com.kai.steering.data.service.entity.dto.QuestionQueryDTO;
import com.kai.steering.data.service.entity.po.QuestionDetails;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;

import lombok.*;

import java.io.Serializable;

/**
 * <pre>
 * 题目详情 Do对象
 * </pre>
 *
 * @author kai
 * @date 2022-02-23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ToString
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "QuestionDetailsDO对象", description = "题目详情业务实体")
public class QuestionDetailsDO implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "题目详情id")
    private String questionDetailsId;
    @ApiModelProperty(value = "题目id")
    private String questionId;
    @ApiModelProperty(value = "内容")
    private String content;
    @ApiModelProperty(value = "创建时间")
    private Date creationDatetime;
    @ApiModelProperty(value = "创建人管理员id或者用户id")
    private String founder;
    @ApiModelProperty(value = "存在0删除1")
    private Integer usable;
    @ApiModelProperty(value = "删除日期")
    private Date deleteDatetime;

    public QuestionDetailsDO(String questionDetailsId, String questionId, String content) {
        this.questionDetailsId = questionDetailsId;
        this.questionId = questionId;
        this.content = content;
    }

    public QuestionDetailsDO(String questionId, String content) {
        this.questionId = questionId;
        this.content = content;
    }
    public QuestionDetailsDO(String content ) {
        this.content = content;
    }
    public QuestionDetailsDO(QuestionDetails questionDetails) {
        convertQuestionDetailsDO(questionDetails);
    }

    public QuestionDetailsDO convertQuestionDetailsDO(QuestionDetails questionDetails) {
        if (questionDetails==null){
            return null;
        }
        this.questionDetailsId = questionDetails.getQuestionDetailsId();
        this.questionId = questionDetails.getQuestionId();
        this.content = questionDetails.getContent();
        this.creationDatetime = questionDetails.getCreationDatetime();
        this.founder = questionDetails.getFounder();
        this.usable = questionDetails.getUsable();
        this.deleteDatetime = questionDetails.getDeleteDatetime();
        return this;
    }
}